/* 
	Game.h

	+ = blank
	@ = black -- client
	O = white -- server

	game_state
		0 = continue state
		1 = winning state
		2 = tied state
*/

#include "Move.h"

#include <string>
#include <iostream>
#include <sstream>
#include <stack>

#include <stdlib.h>	

#define BLANK '+'
#define BLACK '@'
#define WHITE 'O'

using namespace std;

class Game
{
	char board[15][15];
	stack<Move> moves;

public:
	Game()
	{
		for(int i = 0; i < 15; ++i)
			for(int j = 0; j < 15; ++j)
				board[i][j] = BLANK;
	}

	const char get_pos(const int i, const int j);
	const string last_move();

	// check if the move is within the board and if occupied
	bool validate_move(const int i, const int j);
	// move param = ints 1-15
	void move(const int i, const int j, const char p);
	void move(Move m);
	// push move onto stack for undo
	void log_move(const Move m);
	void undo();

	bool check_pos(int r, int c, int sx, int sy);

	int check_state();
	int check_tie();
	
	// static bool check_vert(Game b, Move m);
	// static bool check_horizon(Game b, Move m);
	// static bool check_diagnol(Game b, Move m);
	// static bool check_forward(Game b, Move m);
	// static bool check_back(Game b, Move m);

	// print to stdout
	string display();
	void display_server();
};
